package com.bookcloud.java21.chapter6.抽象类69;

public class AbstractClassExample {
  public static void main(String[] args) {
    // 不能实例化抽象类
    // Shape shape = new hape("红色"); // 编译错误
    // Circle
    Circle circle = new Circle("红色", 5);
    circle.displayInfo();
    double area = circle.getArea();
    System.out.println("圆的面积: " + area);
    // 矩形
    Rectangle rectangle = new Rectangle("蓝色", 4, 6);
    rectangle.displayInfo();
    // 多态
    System.out.println("=========实现多态的演示 ==========");
    Shape shape = circle;
    shape.displayInfo();
    // 覆盖基类
    shape = rectangle;
    shape.displayInfo();
  }
}
